#ifndef A1_H
#define A1_H

#define MAX_COMMAND_LENGTH 20

// timer
int previous;
int delta;
int mins;
int secs;
int tens;
int *timer_value;
int *loader;
int *control;

// UART1
int *line;
	
// UART2
int *flags;
int *data;

// input
char str[MAX_COMMAND_LENGTH];
int ind;
int ret;

// state
int lastTrainSpeed;
char lastSensorChar;
int lastSensorNum;
char switches[256];
		
struct cmd {
	char name[3];
	int arg1;
	int arg2;
};

int putc(int channel, char c);

int getc(int channel);

int a2i(char *str, int n);

int cmp(char *str1, char *str2, int n);

void copy(char *target, char *source, int n);

void parseCommand(char *str, struct cmd *result);

void executeCommand(struct cmd *command);

void checkInput();

void checkTime();

void checkSensor();

void initialize();

void stall(int n);

void resetState();

#endif // A1_H
